package com.wangbo.multi.controller;

import com.wangbo.multi.entity.Camera;
import com.wangbo.multi.exception.enums.BadRequestExceptionEnum;
import com.wangbo.multi.model.ResultObj;
import com.wangbo.multi.service.CameraService;
import com.wangbo.multi.util.ResultObjUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author waves
 * @since 2021-07-13
 */
@RestController
public class CameraController {

    @Resource
    private CameraService cameraService;

    @GetMapping("/camera/{cid}")
    public ResultObj getDetail(@PathVariable Long cid) {
        Camera camera = cameraService.getById(cid);
        if (camera == null)
            return ResultObjUtil.error(BadRequestExceptionEnum.INVALID_FID);
        return ResultObjUtil.success("成功", camera);
    }
}

